namespace MyCollections
{
    public class LinkedListEnumerator<T>
    {
        private LinkedList<T> _linkedList;
        private LinkedListNode<T> _current;

        public LinkedListEnumerator(LinkedList<T> linkedList)
        {
            _linkedList = linkedList;
            _current = null;
        }

        public LinkedListNode<T> Current
        {
            get { return _current; }
        }

        public bool MoveNext()
        {
            if (_current == null) { _current = _linkedList.First; }
            else { _current = _current.Next; }
            return _current != null;
        }

        public void Reset()
        {
            _current = null;
        }

    }
}